<?php
namespace app\api\validate;

use think\Validate;

class Approve extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'title'                  => 'require',
        'type'                   => 'require',
        'user_ids'               => 'require|array',
        'leave_type'             => 'require',
        'leave_time'             => 'require',
        'leave_days'             => 'require',
        'leave_reason'           => 'require',
        'reimburse_name'         => 'require',
        'reimburse_date'         => 'require|date',
        'reimburse_price'        => 'require',
        'reimburse_content'      => 'require|array',
        'rule_id'                => 'require',
        'task_id'                => 'require',
        'purchase_price'         => 'require',
        'part_content'           => 'require|array',
        'id'                     => 'require',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'title.require'              => '流程名称不能为空',
        'type.require'               => '类型不能为空',
        'user_ids.require'           => '审批人不能为空',
        'user_ids.array'             => '审批人数据格式不正确',
        'leave_type.require'         => '请假类型不能为空',
        'leave_time.require'         => '请假时间不能为空',
        'leave_days.require'         => '请假天数不能为空',
        'leave_reason.require'       => '请假原因不能为空',
        'reimburse_name.require'        => '报销名称不能为空',
        'reimburse_date.require'        => '报销日期不能为空',
        'reimburse_date.date'           => '报销日期格式不正确',
        'reimburse_price.require'       => '报销金额不能为空',
        'reimburse_content.require'     => '报销内容不能为空',
        'reimburse_content.array'       => '报销内容格式不正确',
        'rule_id.require'            => '请选择审批流',
        'id.require'                 => '审批id不能为空',
        'task_id.require'            => '任务流不能为空',
        'part_content.require'       => '采购信息不能为空',
        'part_content.array'         => '采购信息数据格式不正确',

    ];

    /**
     * 字段描述
     */
    protected $field = [

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'approve_edit' => ['title','type','user_ids'],
        'leave' => ['leave_type','leave_time','days','reason','rule_id'],
        'reimburse' => ['reimburse_name','reimburse_date','reimburse_price','reimburse_content','rule_id'],
        'purchase' => ['task_id','part_content','rule_id'],
        'operStatus' => ['id'],
    ];

}
